From: kfraser@localhost.localdomain Date: Tue, 25 Jul 2006 14:58:35 +0000 (+0100) Subject: [LINUX] Improve single-page contiguous region creation/destruction X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15786^2~10^2~18 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=5b4b7f681553391bee800f4716dd73cf3fa77bda;p=xen.git [LINUX] Improve single-page contiguous region creation/destruction Batch page table updates and fold TLB flush into last one, reducing number of hypercalls made from ((# of pages) + 1) to just 1. Signed-off-by: Jan Beulich --- diff --git a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c index b153de617e..5dc6646cf5 100644 --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c @@ -266,6 +266,7 @@ static void contiguous_bitmap_clear( /* Protected by balloon_lock. */ #define MAX_CONTIG_ORDER 9 /* 2MB */ static unsigned long discontig_frames[1<> PAGE_SHIFT) + i); - if (HYPERVISOR_update_va_mapping(vstart + (i*PAGE_SIZE), - __pte_ma(0), 0)) - BUG(); + MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), + __pte_ma(0), 0); set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, INVALID_P2M_ENTRY); } + if (HYPERVISOR_multicall(cr_mcl, i)) + BUG(); /* 2. Get a new contiguous memory extent. */ out_frame = __pa(vstart) >> PAGE_SHIFT; @@ -343,15 +345,16 @@ int xen_create_contiguous_region( /* 3. Map the new extent in place of old pages. */ for (i = 0; i < (1UL<>PAGE_SHIFT)+i, frame); } - flush_tlb_all(); + cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order + ? UVMF_TLB_FLUSH|UVMF_ALL + : UVMF_INVLPG|UVMF_ALL; + if (HYPERVISOR_multicall(cr_mcl, i)) + BUG(); if (success) contiguous_bitmap_set(__pa(vstart) >> PAGE_SHIFT, @@ -402,13 +405,14 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order) /* 2. Zap current PTEs. */ for (i = 0; i < (1UL<>PAGE_SHIFT)+i, INVALID_P2M_ENTRY); out_frames[i] = (__pa(vstart) >> PAGE_SHIFT) + i; } + if (HYPERVISOR_multicall(cr_mcl, i)) + BUG(); /* 3. Do the exchange for non-contiguous MFNs. */ rc = HYPERVISOR_memory_op(XENMEM_exchange, &exchange); @@ -429,15 +433,16 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order) /* 4. Map new pages in place of old pages. */ for (i = 0; i < (1UL<>PAGE_SHIFT)+i, frame); } - flush_tlb_all(); + cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order + ? UVMF_TLB_FLUSH|UVMF_ALL + : UVMF_INVLPG|UVMF_ALL; + if (HYPERVISOR_multicall(cr_mcl, i)) + BUG(); balloon_unlock(flags); }